#include <stdio.h>

void exchange(int *, int *);

void main()
{
    int a = 1;
    int b = 2;
    printf("before: a=%d, b=%d\n", a, b);
    exchange(&a, &b);
    printf("after:  a=%d, b=%d\n", a, b);
}

void exchange(int *p1, int *p2)
{
    int temp;
    temp = *p1;
    *p1 = *p2;
    *p2 = temp;
}
